#include <stdio.h>
#include "index.h"
#pragma warning(disable: 6031 4996)

int menu(void) {
    int code, status;
    printf("\n%s%s\n", STATS, STATS);
    printf("Enter the number of the desired hotel:\n");
    printf("1) Fairfield Arms\t\t2) Hotel Olympic\n");
    printf("3) Chertworthy Piaza\t\t4) The Stockton\n");
    printf("5) quit\n");
    printf("\n%s%s\n", STATS, STATS);
    while ((status = scanf("%d", &code)) != 1 || (code < 1 || code > 5)) {
        if (status != 1) {
            scanf("%*s");
        }
        printf("Enter an integer from 1 to 5, please.\n");
    }
    return code;
}

int get_nights(void) {
    int nights;

    printf("How many nights are needed? ");
    while (scanf("%d", &nights) != 1) {
        scanf("%*s");
        printf("Please enter an interger, such as 2.\n");
    }
    return nights;
}


void show_price(double rate, int nights) {
    double total = 0.0;
    double factor = 1.0;

    for (int n = 0; n < nights; n++, factor *= DISCOUNT) {
        total += rate * factor;
    }
    printf("The total cost will be $%0.2f\n", total);
}